package org.sunflower.framework.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class ConsoleUtils {
	//打印
	public static void WriteLine(Object object)
	{
		if (object != null)
		{
			System.out.println(getTime() + ": " + object instanceof String ? object.toString() : JSON.toJSONString(object));
		}
	}
	public static void WriteLine(String format, Object... args)
	{
		System.out.println(getTime() + ": " + String.format(format, args));
	}

	public static void print(JSONObject jo)
	{
		if (jo != null)
		{
			System.out.println(getTime() + ": " + jo.toString());
		}
	}
	public static String getTime()
	{
		SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss");
		return fmt.format(new Date());
	}
}
